package com.dk.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.dk.mapper.TypeMapper;
import com.dk.pojo.Type;
import com.dk.pojo.TypeExample;
import com.dk.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
@org.springframework.stereotype.Service
public class TypeServiceImpl implements TypeService {
    @Autowired
    private TypeMapper typeMapper;
    @Override
    public List<Type> getInfo(String cname) {
        TypeExample ty = new TypeExample();
        TypeExample.Criteria criteria = ty.createCriteria();
        criteria.andTnameLike(cname);
        return typeMapper.selectByExample(ty);
    }

    @Override
    public int insert(Type type) {
        return typeMapper.insert(type);
    }

    @Override
    public Type selectByCid(Integer cid) {
        return typeMapper.selectByPrimaryKey(cid);
    }

    @Override
    public int updaateInfo(Type type) {
        return typeMapper.updateByPrimaryKey(type);
    }

    @Override
    public List<Type> selectInfo() {
        return typeMapper.selectByExample(null);
    }

    @Override
    public int deleteById(Integer cid) {
        return typeMapper.deleteByPrimaryKey(cid);
    }

}
